import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type {
  UserCollectVO,
  UserCollectForm,
  UserCollectQuery,
} from "@/api/userCollect/types";

/**
 * 查询用户收藏夹列表
 * @param query
 * @returns {*}
 */

export const listUserCollect = (
  query?: UserCollectQuery
): AxiosPromise<UserCollectVO[]> => {
  return request({
    url: "/business/userCollect/list",
    method: "get",
    params: query,
  });
};

/**
 * 查询用户收藏夹详细
 * @param id
 */
export const getUserCollect = (
  id: string | number
): AxiosPromise<UserCollectVO> => {
  return request({
    url: "/business/userCollect/" + id,
    method: "get",
  });
};

/**
 * 新增用户收藏夹
 * @param data
 */
export const addUserCollect = (data: UserCollectForm) => {
  return request({
    url: "/business/userCollect",
    method: "post",
    data: data,
  });
};

/**
 * 修改用户收藏夹
 * @param data
 */
export const updateUserCollect = (data: UserCollectForm) => {
  return request({
    url: "/business/userCollect",
    method: "put",
    data: data,
  });
};

/**
 * 删除用户收藏夹
 * @param id
 */
export const delUserCollect = (
  id: string | number | Array<string | number>
) => {
  return request({
    url: "/business/userCollect/" + id,
    method: "delete",
  });
};
